<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="{:url()}" data-auto="true" method="post">
    <input type="hidden" name="id" value='{$vo.id|default=""}'>

    <div class="form-group">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">地址</label>
            <div class="layui-input-inline">
                <input id="text_" type="text" class="layui-input rw30">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <button type='button' onclick="searchByStationName()" class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
        </div>

    </div>

    <div class="form-group">
        <div class="col-md-12">
            <div class="form-control" style="height:auto">
                <div id="container" style="width: 70rem;height: 48rem;border: 1px solid gray; margin-bottom: 0.6rem;"></div>
            </div>
        </div>
    </div>

    <div class="hr-line-dashed" style="clear: both"></div>
    <div class="layui-form-item text-center">
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要关闭吗？" data-close>关闭</button>
    </div>
</form>

<script type="text/javascript">
    var map = new BMap.Map("container");
    map.centerAndZoom("长沙", 15);
    map.enableScrollWheelZoom();    //启用滚轮放大缩小，默认禁用
    map.enableContinuousZoom();    //启用地图惯性拖拽，默认禁用

    map.addControl(new BMap.NavigationControl());  //添加默认缩放平移控件
    map.addControl(new BMap.OverviewMapControl()); //添加默认缩略地图控件
    map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));   //右下角，打开

    var localSearch = new BMap.LocalSearch(map);
    localSearch.enableAutoViewport(); //允许自动调节窗体大小
    map.addEventListener("click", function(e){
        coordinateReciever(e.point.lat, e.point.lng);
    });
    function searchByStationName() {
        map.clearOverlays();//清空原来的标注
        var keyword = document.getElementById("text_").value;

        localSearch.setSearchCompleteCallback(function (searchResult) {
            var poi = searchResult.getPoi(0);
            coordinateReciever(poi.point.lat, poi.point.lng);

            map.centerAndZoom(poi.point, 15);
            var marker = new BMap.Marker(new BMap.Point(poi.point.lng, poi.point.lat));  // 创建标注，为要查询的地方对应的经纬度
            marker.setAnimation(BMAP_ANIMATION_BOUNCE);
            map.addOverlay(marker);

            var content = document.getElementById("text_").value + "<br/><br/>经度：" + poi.point.lng + "<br/>纬度：" + poi.point.lat;
            var infoWindow = new BMap.InfoWindow("<p style='font-size:14px;'>" + content + "</p>");
            marker.addEventListener("click", function () { this.openInfoWindow(infoWindow); });
             marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        });
        localSearch.search(keyword);
    }
</script>